<!-- HTML header for doxygen 1.8.13-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.14"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Taskflow Handbook</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link rel="icon" type="image/x-icon" href="favicon.ico" />
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
  $(document).ready(initResizable);
/* @license-end */</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname"><a href="https://taskflow.github.io/">Taskflow</a>
   &#160;<span id="projectnumber">3.0.0-Master-Branch</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.14 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function(){initNavTree('classtf_1_1TFProfObserver.html','');});
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#nested-classes">Classes</a> &#124;
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="#friends">Friends</a> &#124;
<a href="classtf_1_1TFProfObserver-members.html">List of all members</a>  </div>
  <div class="headertitle">
<div class="title">tf::TFProfObserver Class Reference</div>  </div>
</div><!--header-->
<div class="contents">

<p>observer interface based on <a href="https://taskflow.github.io/tfprof/">Taskflow Profiler</a> format  
 <a href="classtf_1_1TFProfObserver.html#details">More...</a></p>

<p><code>#include &lt;<a class="el" href="observer_8hpp_source.html">observer.hpp</a>&gt;</code></p>
<div class="dynheader">
Inheritance diagram for tf::TFProfObserver:</div>
<div class="dyncontent">
<div class="center"><img src="classtf_1_1TFProfObserver__inherit__graph.png" border="0" usemap="#tf_1_1TFProfObserver_inherit__map" alt="Inheritance graph"/></div>
<map name="tf_1_1TFProfObserver_inherit__map" id="tf_1_1TFProfObserver_inherit__map">
<area shape="rect" id="node2" href="classtf_1_1ObserverInterface.html" title="The interface class for creating an executor observer. " alt="" coords="5,5,148,31"/>
</map>
<center><span class="legend">[<a target="top" href="graph_legend.html">legend</a>]</span></center></div>
<div class="dynheader">
Collaboration diagram for tf::TFProfObserver:</div>
<div class="dyncontent">
<div class="center"><img src="classtf_1_1TFProfObserver__coll__graph.png" border="0" usemap="#tf_1_1TFProfObserver_coll__map" alt="Collaboration graph"/></div>
<map name="tf_1_1TFProfObserver_coll__map" id="tf_1_1TFProfObserver_coll__map">
<area shape="rect" id="node2" href="classtf_1_1ObserverInterface.html" title="The interface class for creating an executor observer. " alt="" coords="5,5,148,31"/>
</map>
<center><span class="legend">[<a target="top" href="graph_legend.html">legend</a>]</span></center></div>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:a663445b21a03abaccfd32b199b7b10a1"><td class="memTemplParams" colspan="2"><a id="a663445b21a03abaccfd32b199b7b10a1"></a>
template&lt;typename T &gt; </td></tr>
<tr class="memitem:a663445b21a03abaccfd32b199b7b10a1"><td class="memTemplItemLeft" align="right" valign="top">void&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="classtf_1_1TFProfObserver.html#a663445b21a03abaccfd32b199b7b10a1">dump</a> (T &amp;ostream) const</td></tr>
<tr class="memdesc:a663445b21a03abaccfd32b199b7b10a1"><td class="mdescLeft">&#160;</td><td class="mdescRight">dumps the timelines into a <a href="https://taskflow.github.io/tfprof/">Taskflow Profiler</a> format through an output stream object that defines stream insertion operator <code>&lt;&lt;</code> <br /></td></tr>
<tr class="separator:a663445b21a03abaccfd32b199b7b10a1"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a59e82cb3f9b0ada38aa1ddea14f14d02"><td class="memItemLeft" align="right" valign="top"><a id="a59e82cb3f9b0ada38aa1ddea14f14d02"></a>
<a class="elRef" doxygen="/Users/twhuang/PhD/Code/taskflow/doxygen/cppreference-doxygen-web.tag.xml:http://en.cppreference.com/w/" href="http://en.cppreference.com/w/cpp/string/basic_string.html">std::string</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classtf_1_1TFProfObserver.html#a59e82cb3f9b0ada38aa1ddea14f14d02">dump</a> () const</td></tr>
<tr class="memdesc:a59e82cb3f9b0ada38aa1ddea14f14d02"><td class="mdescLeft">&#160;</td><td class="mdescRight">dumps the timelines into a JSON string <br /></td></tr>
<tr class="separator:a59e82cb3f9b0ada38aa1ddea14f14d02"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a5e1f63034a96a5a79cef6da412efd203"><td class="memItemLeft" align="right" valign="top"><a id="a5e1f63034a96a5a79cef6da412efd203"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classtf_1_1TFProfObserver.html#a5e1f63034a96a5a79cef6da412efd203">clear</a> ()</td></tr>
<tr class="memdesc:a5e1f63034a96a5a79cef6da412efd203"><td class="mdescLeft">&#160;</td><td class="mdescRight">clears the timeline data <br /></td></tr>
<tr class="separator:a5e1f63034a96a5a79cef6da412efd203"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a8b3b0bee8762af654cfebd2bb2ee98ed"><td class="memItemLeft" align="right" valign="top"><a id="a8b3b0bee8762af654cfebd2bb2ee98ed"></a>
size_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classtf_1_1TFProfObserver.html#a8b3b0bee8762af654cfebd2bb2ee98ed">num_tasks</a> () const</td></tr>
<tr class="memdesc:a8b3b0bee8762af654cfebd2bb2ee98ed"><td class="mdescLeft">&#160;</td><td class="mdescRight">queries the number of tasks observed <br /></td></tr>
<tr class="separator:a8b3b0bee8762af654cfebd2bb2ee98ed"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="inherit_header pub_methods_classtf_1_1ObserverInterface"><td colspan="2" onclick="javascript:toggleInherit('pub_methods_classtf_1_1ObserverInterface')"><img src="closed.png" alt="-"/>&#160;Public Member Functions inherited from <a class="el" href="classtf_1_1ObserverInterface.html">tf::ObserverInterface</a></td></tr>
<tr class="memitem:adfd71c3af3ae2ea4f41eed26c1b6f604 inherit pub_methods_classtf_1_1ObserverInterface"><td class="memItemLeft" align="right" valign="top"><a id="adfd71c3af3ae2ea4f41eed26c1b6f604"></a>
virtual&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classtf_1_1ObserverInterface.html#adfd71c3af3ae2ea4f41eed26c1b6f604">~ObserverInterface</a> ()=default</td></tr>
<tr class="memdesc:adfd71c3af3ae2ea4f41eed26c1b6f604 inherit pub_methods_classtf_1_1ObserverInterface"><td class="mdescLeft">&#160;</td><td class="mdescRight">virtual destructor <br /></td></tr>
<tr class="separator:adfd71c3af3ae2ea4f41eed26c1b6f604 inherit pub_methods_classtf_1_1ObserverInterface"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="friends"></a>
Friends</h2></td></tr>
<tr class="memitem:a763b2f90bc53f92d680a635fe28e858e"><td class="memItemLeft" align="right" valign="top"><a id="a763b2f90bc53f92d680a635fe28e858e"></a>
class&#160;</td><td class="memItemRight" valign="bottom"><b>Executor</b></td></tr>
<tr class="separator:a763b2f90bc53f92d680a635fe28e858e"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>observer interface based on <a href="https://taskflow.github.io/tfprof/">Taskflow Profiler</a> format </p>
<p>A <a class="el" href="classtf_1_1TFProfObserver.html" title="observer interface based on Taskflow Profiler format ">tf::TFProfObserver</a> inherits <a class="el" href="classtf_1_1ObserverInterface.html" title="The interface class for creating an executor observer. ">tf::ObserverInterface</a> and defines methods to dump the observed thread activities into a format that can be visualized through <a href="https://taskflow.github.io/tfprof/">Taskflow Profiler</a>.</p>
<div class="fragment"><div class="line"><a class="code" href="classtf_1_1Taskflow.html">tf::Taskflow</a> taskflow;</div><div class="line"><a class="code" href="classtf_1_1Executor.html">tf::Executor</a> executor;</div><div class="line"></div><div class="line"><span class="comment">// insert tasks into taskflow</span></div><div class="line"><span class="comment">// ...</span></div><div class="line">  </div><div class="line"><span class="comment">// create a custom observer</span></div><div class="line"><a class="codeRef" doxygen="/Users/twhuang/PhD/Code/taskflow/doxygen/cppreference-doxygen-web.tag.xml:http://en.cppreference.com/w/" href="http://en.cppreference.com/w/cpp/memory/shared_ptr.html">std::shared_ptr&lt;tf::TFProfObserver&gt;</a> observer = executor.<a class="code" href="classtf_1_1Executor.html#a3e68a0d779cfee1554c88c2596ae9000">make_observer</a>&lt;<a class="code" href="classtf_1_1TFProfObserver.html">tf::TFProfObserver</a>&gt;();</div><div class="line"></div><div class="line"><span class="comment">// run the taskflow</span></div><div class="line">executor.<a class="code" href="classtf_1_1Executor.html#a81f35d5b0a20ac0646447eb80d97c0aa">run</a>(taskflow).wait();</div><div class="line"></div><div class="line"><span class="comment">// dump the thread activities to Taskflow Profiler format.</span></div><div class="line">observer-&gt;dump(<a class="codeRef" doxygen="/Users/twhuang/PhD/Code/taskflow/doxygen/cppreference-doxygen-web.tag.xml:http://en.cppreference.com/w/" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a>);</div></div><!-- fragment --><p>We recommend using our <a href="https://taskflow.github.io/tfprof/">Taskflow Profiler</a> python script to observe thread activities instead of the raw function call. The script will turn on environment variables needed for observing all executors in a taskflow program and dump the result to a valid, clean JSON file compatible with the format of <a href="https://taskflow.github.io/tfprof/">Taskflow Profiler</a>. </p>
</div><hr/>The documentation for this class was generated from the following file:<ul>
<li><a class="el" href="observer_8hpp_source.html">observer.hpp</a></li>
</ul>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><b>tf</b></li><li class="navelem"><a class="el" href="classtf_1_1TFProfObserver.html">TFProfObserver</a></li>
    <li class="footer">Generated by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.14 </li>
  </ul>
</div>
</body>
</html>
